import request from '@/utils/request'

const busiGroupId = 1001
const profGroupId = 1002

function getConfigTree(groupId) {
  return request({
    url: 'config/tree/' + groupId,
    method: 'post'
  })
}

export function getBusiConfigTree() {
  return getConfigTree(busiGroupId)
}

export function getProfConfigTree() {
  return getConfigTree(profGroupId)
}

export function getProjectConfigList(groupId) {
  return request({
    url: 'config/list',
    method: 'post',
    params: { groupId }
  })
}

export function getBusiConfigList() {
  return request({
    url: 'config/list/busi',
    method: 'post'
  })
}

export function getInfoConfigList() {
  return request({
    url: 'config/list/info',
    method: 'post'
  })
}

export function getCaseConfigList() {
  return request({
    url: 'config/list/case',
    method: 'post'
  })
}

export function getProfConfigList() {
  return request({
    url: 'config/list/prof',
    method: 'post'
  })
}

export function getConfigHomeImages() {
  return request({
    url: 'config/home/image/list',
    method: 'post'
  })
}

export function getProjectConfig(id) {
  return request({
    url: 'config/get',
    method: 'post',
    params: { id }
  })
}

export function addProjectConfig(data) {
  return request({
    url: 'config/add',
    method: 'post',
    data
  })
}

export function editProjectConfig(data) {
  return request({
    url: 'config/edit',
    method: 'post',
    data
  })
}

export function delProjectConfig(id) {
  return request({
    url: 'config/del',
    method: 'post',
    params: { id }
  })
}
